#include <iostream>
#include <vector>
#include <chrono>
#include <string.h>
#include "../include/ThreadPool.h"

int func(char * s){
    char *dest = (char *)malloc(3);
    memcpy(dest, s, 3);
    return 0;
}


int main()
{
    
    ThreadPool pool(4);
    std::vector< std::future<int> > results;
    char *s = "abc";
    for(int i = 0; i < 4; ++i) {
        results.emplace_back(
            pool.enqueue(func, s)
        );
    }
    //free(s);
    for(auto && result: results)
        std::cout << result.get() << ' ';
    std::cout << std::endl;
    free(s);
    return 0;
}